
include ../../common.mk

BOOST_LIBS=boost_system boost_date_time boost_program_options boost_thread boost_regex boost_random
INCLUDE_PATHS=-I$(BOOST_INCLUDE) -I$(WEBSOCKET_INCLUDE) -I$(JSON_INCLUDE) -Iinclude
LIB_PATHS=-L$(BOOST_LIB_PATH) -L$(WEBSOCKET_LIB_PATH) -L$(JSON_LIB_PATH)

LIBS=$(BOOST_LIBS:%=-l%) -lwebsocketpp -lssl

SRC=\
   src/Application.cpp                                \
   src/Channel.cpp                                    \
   src/Packet.cpp                                     \
   src/TcpConnection.cpp                              \
   src/TcpMessage.cpp                                 \
   src/ServerSettings.cpp                             \
   src/BasicAuthenticator.cpp                         \
   src/client/TcpClient.cpp                           \
   src/clientconnection/ClientConnection.cpp          \
   src/clientconnection/HttpRequestParser.cpp         \
   src/clientconnection/HttpReply.cpp                 \
   src/clientconnection/LongPollConnection.cpp        \
   src/clientconnection/TcpClientConnection.cpp       \
   src/clientconnection/LongPollClientConnection.cpp  \
   src/server/Server.cpp                              \
   src/server/TcpServer.cpp                           \
   src/server/LongPollServer.cpp                      \

OBJS=$(patsubst %.cpp,%.o,$(SRC))

all: libConnectionBroker.so

%.o : %.cpp
	$(CC) $(INCLUDE_PATHS) $(DEBUG) -fPIC -c $^ -o $@ 

libConnectionBroker.so: $(OBJS)
	$(CC) $(LIB_PATHS) $(LIBS) $(DEBUG) -shared -o $@ $^ 

clean:
	rm -rf */*/*.o */*.o *.o *.so 
